//
//  UISearchBar+Clear.m
//  linktuIOS
//
//  Created by hejunsong on 16/9/19.
//  Copyright © 2016年 张伟. All rights reserved.
//

#import "UISearchBar+Clear.h"

@implementation UISearchBar (Clear)
-(void)clearBackgroundColor
{
    for (UIView *view in self.subviews) {
        // for before iOS7.0
        if ([view isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) {
            [view removeFromSuperview];
            break;
        }
        // for later iOS7.0(include)
        if ([view isKindOfClass:NSClassFromString(@"UIView")] && view.subviews.count > 0) {
            [[view.subviews objectAtIndex:0] removeFromSuperview];
            break;
        }
    }
    self.backgroundColor = UIColorFromRGB(0xf0f0f0);

}
@end
